<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('活动参与人员列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <input id="id" name="id" th:value="*{id}" type="hidden">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>用户昵称：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <!--<div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="whzj:user:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="whzj:user:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="whzj:user:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="whzj:user:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>-->
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('whzj:user:edit')}]];
        var removeFlag = [[${@permission.hasPermi('whzj:user:remove')}]];
        var prefix = ctx + "whzj/activityuser";

        $(function() {
            var options = {
                url: prefix + "/listByActivity?id="+$("#id").val(),
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                showPageGo: true,
                modalName: "活动参与人员",
                columns: [{
                    radio: true
                },
                {
                    field: 'id',
                    title: '活动参与人员id',
                    visible: false
                },
                {
                    field: 'userId',
                    title: '用户ID'
                },{
                    field: 'userName',
                    title: '用户昵称'
                },
                {
                    field: 'activityNum',
                    title: '活动期数'
                },
                {
                    field: 'num',
                    title: '参与次数'
                },
                {
                    field: 'integral',
                    title: '消耗总积分数'
                },
                {
                    field: 'status',
                    title: '状态'
                }]
            };
            $.table.init(options);
        });

        /* 添加用户-选择用户-提交 */
        function submitHandler() {
            debugger;
            var rows = $.table.selectFirstColumns();
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            var data = $("#" + table.options.id).bootstrapTable('getSelections');
            $.ajax({
                type: "post",
                url: ctx + "/whzj/activity/settingWin?id="+$("#id").val()+"activityUserId="+rows[0],
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(r) {
                    $.modal.msgSuccess("设置成功");
                    $.modal.close();
                }
            });
        }
    </script>
</body>
</html>